package com.mail.manager.modular.service.impl.portal;

import com.mail.manager.modular.mapper.NewsMapper;
import com.mail.manager.modular.model.News;
import com.mail.manager.modular.service.portal.INewsService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;

/**
 * 创建人： Shi Heng
 * 创建时间：2018-04-09 16:27
 * QQ：374696376
 * Description：
 */
@Service
public class NewsServiceImpl implements INewsService {

    @Resource
    NewsMapper newsMapper;


    @Override
    public News selectByPrimaryKey(Object id) {
        return newsMapper.selectByPrimaryKey(id);
    }

    @Override
    public boolean insert(News news) {
        int insert = newsMapper.insert(news);
        if(insert>0)
            return true;
        return false;
    }

    @Override
    public List<Map<String, Object>> list(String conditiion) {
        return newsMapper.list(conditiion);
    }

    @Override
    public boolean delteObject(Integer id) {
        int delete = newsMapper.deleteByPrimaryKey(id);
        if(delete>0)
            return true;
        return false;
    }

    @Override
    public boolean updateObjtById(News news) {
        int update = newsMapper.updateByPrimaryKey(news);
        if(update>0)
            return true;
        return false;
    }
}
